﻿using System.Collections.Generic;
using FileMonitor.Configuration.Prototype;
using FileMonitor.Configuration.Prototype.Provider;
using FileMonitor.Configuration.Providers;
using FileMonitor.Service.Prototype;

namespace FileMonitor.Service.Provider.ProcessProvider
{
    public class FileMonitorProcessXMLConfigProvider:FileMonitorProcessProviderBase
    {
        public override FileProcessProviderCollection GetAllProcess()
        {
          IProvider provider=  ProviderService.GetProvider();
          Dictionary<string,WorkProcessBase> dicWorkProcesses= provider.GetAllWorkProcess();
          FileMonitorBase fp = null;
          FileProcessProviderCollection collection = new FileProcessProviderCollection();
          foreach (string key in dicWorkProcesses.Keys)
          {
              WorkProcessBase wp = dicWorkProcesses[key];
              if (wp != null)
              {
                  fp = Adapter.FileMonitorProcessBaseAdpter.ConvertFromWorkProcessBase(wp);
                  collection.Add(fp);
              }
          }
          return collection;
        }

        public override void Initialize(System.Collections.Specialized.NameValueCollection config)
        {
            base.Initialize(config);
        }

        public override void LockProcess(FileMonitorBase process)
        {
            
        }
    }
}
